package com.yuwei.patrol.adapter

import android.graphics.Color
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yuwei.patrol.R

class EditTopAdapter: BaseQuickAdapter<String, BaseViewHolder>(
    R.layout.edit_top_item
) {
    private var mPosition : Int = 0
    fun setPosition(position: Int){
        mPosition = position
    }
    override fun convert(holder: BaseViewHolder, item: String) {
        val tv = holder.getView<TextView>(R.id.item_title)
        tv.text = item
        if(holder.adapterPosition == mPosition){
            tv.setBackgroundResource(R.drawable.patrol_top_item_bg2)
            tv.setTextColor(Color.WHITE)
        }else{
            tv.setBackgroundResource(R.drawable.patrol_top_item_bg)
            tv.setTextColor(Color.BLACK)
        }
    }
}